package io.kiki.sba.registry.store.jdbc.mapper;

import io.kiki.sba.registry.store.jdbc.domain.InterfaceAppsIndexDomain;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Set;

public interface InterfaceAppsIndexMapper {

    /**
     * insert on replace
     */
    int replace(InterfaceAppsIndexDomain domain);

    /**
     * insert
     *
     * @param domain domain
     * @return effect rows number
     */
    int update(InterfaceAppsIndexDomain domain);

    /**
     * query domains which gmt_modified is after than maxUpdate
     *
     * @param dataCenters dataCenters
     * @param maxId       maxId
     * @param limitCount  limitCount
     * @return List
     */
    List<InterfaceAppsIndexDomain> queryLargeThan(@Param("dataCenters") Set<String> dataCenters, @Param("maxId") long maxId, @Param("limitCount") int limitCount);

    int cleanDeleted(@Param("dataCenter") String dataCenter, @Param("beforeTime") Date beforeTime, @Param("limit") int limit);
}
